# -*- coding: utf-8 -*-
from fastapi import FastAPI
from fastapi.responses import RedirectResponse
from fastapi.openapi.docs import get_swagger_ui_html


from app.api.routers import v1


def register_app():
    # FastAPI
    app = FastAPI()

    # 路由
    register_docs(app)
    register_router(app)

    return app


def register_docs(app: FastAPI):
    @app.get("/", tags=['Docs'])
    def index():
        return RedirectResponse("/docs")


def register_router(app: FastAPI):
    """
    路由

    :param app: FastAPI
    :return:
    """
    app.include_router(
        v1,
    )
